package com.stormrage.edu.ctrl.fina;

import java.io.File;
import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.alibaba.fastjson.JSON;
import com.stormrage.edu.serv.adm.AdmAcctServ;
import com.stormrage.edu.serv.learn.LeaBunchServ;
import com.stormrage.edu.serv.learn.LeaStudentServ;
import com.stormrage.entity.adm.AdmRes;
import com.stormrage.entity.learn.req.LeaBunchReq;
import com.stormrage.entity.learn.req.LeaStudentReq;
import com.stormrage.entity.rep.ErrorRep;
import com.stormrage.entity.rep.JsonRep;
import com.stormrage.entity.rep.ListRep;
import com.stormrage.entity.shiro.ShiroAcct;
import com.stormrage.shiro.bind.CurrentUser;
import com.stormragetech.core.ctrl.BaseCtrl;
import com.stormragetech.core.entity.Page;

/**
 * @Title: FinanceCtrl.java
 * @Package com.stormrage.edu.ctrl.fina
 * @Description: 财务 Controller
 * @author www.stormragetech.com
 * @date 2016年4月14日
 * @version V1.0
 */
@Controller
@RequestMapping("/fina")
public class FinanceCtrl extends BaseCtrl {

	private static final Logger logger = LoggerFactory.getLogger(FinanceCtrl.class);

	@Value("#{constants['html.title']}")
	private String htmlTitle;

	@Value("#{constants['path.root']}")
	private String rootPath;

	@Value("#{constants['path.excel']}")
	private String excelPath;

	@Autowired
	private AdmAcctServ admAcctServ;

	@Autowired
	private LeaBunchServ leaBunchServ;

	@Autowired
	private LeaStudentServ leaStudentServ;

	@RequiresPermissions("fina:view")
	@RequestMapping(value = "/bunch/list")
	public String bunch(@CurrentUser ShiroAcct curr, LeaBunchReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Bunch 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Bunch 】-【 GET 】- 结束运行  ");
		return "fina/bunch/list";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/bunch/ajax", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String bunchAjax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, LeaBunchReq req) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Bunch Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaBunchReq.instance(req, rootPath + excelPath + File.separator, null, 0, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaBunchServ.queryListByLock(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Bunch Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("fina:view")
	@RequestMapping(value = "/bunch/list/{id}")
	public String stu(@CurrentUser ShiroAcct curr, LeaStudentReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu 】-【 GET 】- 结束运行  ");
		return "fina/bunch/student";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/bunch/ajax/{id}", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String stuAjax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, @PathVariable("id") Integer id,
			LeaStudentReq req) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaStudentReq.instance(id, 0, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaStudentServ.queryListByBunchLock(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/bunch/pass/{cid}/{id}", method = RequestMethod.GET)
	public String pass(@CurrentUser ShiroAcct curr, @PathVariable("cid") Integer cid, @PathVariable("id") Integer id,
			RedirectAttributes redirect) {

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 pass 】-【 GET 】- 开始运行 ");

		ErrorRep err = null;
		String errMsg = "";

		try {

			// ------------------ Ctrl操作 ------------------

			leaStudentServ.update(id);

			errMsg = "提示信息：修改编号为【 " + id + " 】的学员的审核状态成功";
			err = ErrorRep.instance(true, errMsg);
			redirect.addFlashAttribute("err", err);

		} catch (Exception e) {
			errMsg = "提示信息：修改编号为【 " + id + " 】的学员的审核状态失败";
			err = ErrorRep.instance(false, errMsg);
			redirect.addFlashAttribute("err", err);
			return "redirect:/fina/bunch/list/{cid}";
		}

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 pass 】-【 GET 】- 结束运行 ");
		return "redirect:/fina/bunch/list/{cid}";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/apply")
	public String apply(@CurrentUser ShiroAcct curr, LeaBunchReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Apply 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Apply 】-【 GET 】- 结束运行  ");
		return "fina/apply/list";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/ajax", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String ajax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, LeaBunchReq req) {

		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaBunchReq.instance(req, rootPath + excelPath + File.separator, 1, 1, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaBunchServ.queryListForApply(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/pass/{id}", method = RequestMethod.GET)
	public String pass(@CurrentUser ShiroAcct curr, Model model) {

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 pass 】-【 GET 】- 开始运行 ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 pass 】-【 GET 】- 结束运行  ");
		return "fina/apply/pass";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/pass/{id}", method = RequestMethod.POST)
	public String pass(@CurrentUser ShiroAcct curr, @PathVariable("id") Integer id, RedirectAttributes redirect) {

		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Pass 】-【 POST 】-【 STARTED 】");

		ErrorRep err = null;
		String errMsg = "";

		try {

			// ------------------ Ctrl操作 ------------------
			leaBunchServ.updateLockToSchedule(id);
			errMsg = "提示信息：通过编号为【 " + id + " 】的班级的审核已提交至计划，请等待程序处理";
			err = ErrorRep.instance(true, errMsg);
			redirect.addFlashAttribute("err", err);

		} catch (Exception e) {
			errMsg = "提示信息：通过编号为【 " + id + " 】的班级的审核失败";
			err = ErrorRep.instance(false, errMsg);
			redirect.addFlashAttribute("err", err);
			return "redirect:/fina/apply";
		}

		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Pass 】-【 POST 】-【 COMPLETED 】");
		return "redirect:/fina/apply";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/single/list")
	public String single(@CurrentUser ShiroAcct curr, LeaBunchReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Single 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Single 】-【 GET 】- 结束运行  ");
		return "fina/single/list";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/single/ajax", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String singleAjax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, LeaBunchReq req) {

		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Single Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaBunchReq.instance(req, rootPath + excelPath + File.separator, 0, null, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaBunchServ.queryListForSingle(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Single Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/badd/list")
	public String bunchAdd(@CurrentUser ShiroAcct curr, LeaBunchReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Single 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Single 】-【 GET 】- 结束运行  ");
		return "fina/single/badd";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/badd/ajax", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String bunchAddAjax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, LeaBunchReq req) {

		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Single Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaBunchReq.instance(req, rootPath + excelPath + File.separator, 1, 1, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaBunchServ.queryListForSingle(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 EduChapterCtrl 】- 【 Single Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("fina:view")
	@RequestMapping(value = "/single/list/{id}")
	public String singleStu(@CurrentUser ShiroAcct curr, LeaStudentReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu 】-【 GET 】- 结束运行  ");
		return "fina/bunch/student";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/single/ajax/{id}", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String singleStuAjax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, @PathVariable("id") Integer id,
			LeaStudentReq req) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaStudentReq.instance(id, 1, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaStudentServ.queryListByBunchLock(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("fina:view")
	@RequestMapping(value = "/badd/list/{id}")
	public String bAddStu(@CurrentUser ShiroAcct curr, LeaStudentReq req, Model model) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 bAddStu 】-【 GET 】- 开始运行  ");

		try {

			// ------------------ 获取用户操作的 Menu ------------------
			List<AdmRes> menus = admAcctServ.queryMenuById(Integer.valueOf(curr.getId()));

			// ------------------ Ctrl 操作 ------------------
			String search = JSON.toJSONString(req);

			logger.debug(" 查询条件req变为search为 " + search);

			if (null != search && search.length() > 0)
				model.addAttribute("search", search);

			model.addAttribute("user", curr);
			model.addAttribute("menus", menus);
			model.addAttribute("htmlTitle", htmlTitle);

			model.addAttribute("form", req);

		} catch (Exception e) {
			model.addAttribute("err", e.getMessage());
			return "error/500";
		}

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 bAddStu 】-【 GET 】- 结束运行  ");
		return "fina/bunch/student";

	}

	@RequiresPermissions("fina:pass")
	@RequestMapping(value = "/badd/ajax/{id}", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
	@ResponseBody
	public String bAddStuAjax(@RequestParam(value = "draw", required = true) Integer draw,
			@RequestParam(value = "start", required = true) Integer start,
			@RequestParam(value = "length", required = true) Integer length, @PathVariable("id") Integer id,
			LeaStudentReq req) {

		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu Ajax 】-【 POST 】-【 STARTED 】");

		String json = null;

		try {

			// ------------------ 获取初始化模块的状态 ------------------
			Page page = Page.instance(start, length, 1);
			req = LeaStudentReq.instance(id, 1, page);
			draw += 1;

			logger.debug(" 查询信息为 " + req.toString());

			ListRep entity = leaStudentServ.queryListByBunchLock(req);

			JsonRep rep = JsonRep.instance(entity.getCount(), draw, entity.getList());
			json = JSON.toJSONString(rep);

		} catch (Exception e) {
			return "error/500";
		}

		logger.debug(" 返回的json为 " + json);
		logger.debug(" 【 Controller 】- 【 FinanceCtrl 】- 【 Stu Ajax 】-【 POST 】-【 COMPLETED 】");
		return json;

	}

	@RequiresPermissions("chap:del")
	@RequestMapping(value = "/single/pass/{cid}/{id}", method = RequestMethod.GET)
	public String singlePass(@CurrentUser ShiroAcct curr, @PathVariable("cid") Integer cid,
			@PathVariable("id") Integer id, RedirectAttributes redirect) {

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 Delete 】-【 GET 】- 开始运行 ");

		ErrorRep err = null;
		String errMsg = "";

		try {

			// ------------------ Ctrl操作 ------------------

			leaStudentServ.updateForApply(id);

			errMsg = "提示信息：修改编号为【 " + id + " 】的学员的审核状态成功";
			err = ErrorRep.instance(true, errMsg);
			redirect.addFlashAttribute("err", err);

		} catch (Exception e) {
			errMsg = "提示信息：修改编号为【 " + id + " 】的学员的审核状态失败";
			err = ErrorRep.instance(false, errMsg);
			redirect.addFlashAttribute("err", err);
			return "redirect:/fina/single/list/{cid}";
		}

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 Delete 】-【 GET 】- 结束运行 ");
		return "redirect:/fina/bunch/list/{cid}";

	}

	@RequiresPermissions("chap:del")
	@RequestMapping(value = "/badd/pass/{cid}/{id}", method = RequestMethod.GET)
	public String bAddPass(@CurrentUser ShiroAcct curr, @PathVariable("cid") Integer cid,
			@PathVariable("id") Integer id, RedirectAttributes redirect) {

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 Delete 】-【 GET 】- 开始运行 ");

		ErrorRep err = null;
		String errMsg = "";

		try {

			// ------------------ Ctrl操作 ------------------

			leaStudentServ.updateForApply(id);

			errMsg = "提示信息：修改学员的审核状态成功";
			err = ErrorRep.instance(true, errMsg);
			redirect.addFlashAttribute("err", err);

		} catch (Exception e) {
			errMsg = "提示信息：修改学员的审核状态失败";
			err = ErrorRep.instance(false, errMsg);
			redirect.addFlashAttribute("err", err);
			return "redirect:/fina/badd/list/{cid}";
		}

		logger.debug(" 【 Controller 】-【 FinanceCtrl 】-【 Delete 】-【 GET 】- 结束运行 ");
		return "redirect:/fina/bunch/list/{cid}";

	}

}
